import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xinxuan/controllers/common_page_controller.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:get/get.dart';
import 'package:xinxuan/utils/color_util.dart';

class CancelAccountDialog extends Dialog {

  final CommonPageController commonPageController = Get.find();

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          decoration: BoxDecoration(
            color: bgWhiteColor,
            borderRadius: BorderRadius.circular(12.w)
          ),
          width: 320.w,
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Container(
                padding: EdgeInsets.symmetric(vertical: 32.h, horizontal: 25.w),
                child: Column(
                  children: [
                    Text(
                      '账号注销',
                      textAlign: TextAlign.center,
                      style: TextStyle(
                        color: textBlackColor,
                        fontSize: 20.sp
                      ),
                    ),
                    SizedBox(height: 20.h),
                    Container(
                      alignment: Alignment.centerLeft,
                      child: Text(
                        '账号注销风险',
                        style: TextStyle(
                          fontSize: 16.sp,
                          fontWeight: FontWeight.bold
                        ),
                      ),
                    ),
                    SizedBox(height: 6.h),
                    Container(
                      alignment: Alignment.centerLeft,
                      child: Text(
                      '一旦注销，你将无法使用该账号登录魔法星选服务凭条，注销后将永久抹除平台的所有信息，包括账户已购买商品，个人资料等',
                        style: TextStyle(
                          fontSize: 14.sp,
                          color: textSubtitleColor
                        ),
                      ),
                    )
                  ],
                ),
              ),
              Container(
                height: 54.h,
                decoration: BoxDecoration(
                  border: Border(
                    top: BorderSide(
                      width: .5,
                      color: lineColor
                    )
                  )
                ),
                child: Row(
                  children: [
                    InkWellUtil.shakeProofInkWell(Container(
                      width: 160.w,
                      height: 54.h,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                        border: Border(
                          right: BorderSide(
                            width: .5,
                            color: lineColor
                          )
                        )
                      ),
                      child: Text(
                        '取消',
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: mainTextColor
                        ),
                      ),
                    ), () async {
                      Get.back();
                    }),
                    InkWellUtil.shakeProofInkWell(Container(
                      width: 159.w,
                      height: 54.h,
                      alignment: Alignment.center,
                      child: Text(
                        '确认注销',
                        style: TextStyle(
                          fontSize: 16.sp,
                          color: textSubtitleColor
                        ),
                      ),
                    ), () async {
                      commonPageController.cancelAccount();
                    })
                  ],
                )
              )
            ],
          ),
        ),
      ),
    );
  }
}